/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author FIRE
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';

const { ctxPath, adminPath } = useGlobSetting();

export interface U8XtLog extends BasicModel<U8XtLog> {
  vouchId?: string; // 来源单据
  sortNum?: number; // 顺序
  toDjtype?: string; // 目标单据
  xtStatus?: string; // 执行状态
  cresult?: string; // 执行结果
  acctid?: string; // 账套
  bsource?: string; // 协同开始
  bend?: string; // 协同结束
  ddate?: string; // 单据日期
  croute?: string; // 协同路线
  routeStatus?: string; // 协同状态
  xtDjno?: string; // U8单据号
  djNum?: number; // U8单据数量
}

export const u8XtLogList = (params?: U8XtLog | any) =>
  defHttp.get<U8XtLog>({ url: adminPath + '/shop/xtlog/u8XtLog/list', params });

export const u8XtLogListData = (params?: U8XtLog | any) =>
  defHttp.post<Page<U8XtLog>>({ url: adminPath + '/shop/xtlog/u8XtLog/listData', params });

export const u8XtLogForm = (params?: U8XtLog | any) =>
  defHttp.get<U8XtLog>({ url: adminPath + '/shop/xtlog/u8XtLog/form', params });

export const u8XtLogSave = (params?: any, data?: U8XtLog | any) =>
  defHttp.postJson<U8XtLog>({ url: adminPath + '/shop/xtlog/u8XtLog/save', params, data });

export const u8XtLogImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/shop/xtlog/u8XtLog/importData',
      onUploadProgress,
    },
    params,
  );

export const u8XtLogDelete = (params?: U8XtLog | any) =>
  defHttp.get<U8XtLog>({ url: adminPath + '/shop/xtlog/u8XtLog/delete', params });

export const reStartXt = (params?: U8XtLog | any) =>
  defHttp.post<U8XtLog>({ url: adminPath + '/shop/xtlog/u8XtLog/reStartXt', params });

export const closeXt = (params?: U8XtLog | any) =>
  defHttp.post<U8XtLog>({ url: adminPath + '/shop/xtlog/u8XtLog/closeXt', params });
